﻿using System;
using System.Collections.Generic;
using IFRS.DataAccess.DAL;
using IFRS.Models;
using IFRS.Web;

public partial class IFRS_WIN31_GL_LOT_3V : PageBase
{
    #region === Event ===

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ViewMenu();
            BindControl();
            BindData();
        }
        else
            ClientScript.RegisterHiddenField("isPostBack", "1");
    }
    protected void btnCANCEL_Click(object sender, EventArgs e)
    {
        Response.Redirect("~/IFRS/WIN31_1S.aspx");
    }

    #endregion

    #region === Method ===

    private void ViewMenu()
    {
        MenuTitleBar = Resources.ifrsMenu.WIN31_GL_LOT_3V;
    }
    private void BindControl()
    {
        SetControlReadOnly(form_control);
    }
    private void BindData()
    {
        if (Convert.ToString(Request.QueryString["id"]) != string.Empty)
        {
            var id = Convert.ToInt32(Request.QueryString["id"]);
            var dt = new SPR_GLACCOUNTPOSTING().SEARCH_BYID(id);
            if (dt != null && dt.Rows.Count > 0)
            {
                var list = new List<GLAccountPosting>();
                ConvertHelper.ConvertDataTableToObject(dt, list);

                hddGLGroupID.Value = list[0].GLGroupID.AsString();
                txtGLGroup.Text = list[0].GLGroup_NAME;

                hddGLAccount_ID.Value = list[0].GLAccountID.AsString();
                hddGL_ADJ_INT_INC_PL_ID.Value = list[0].GL_ADJ_INT_INC_PL_ID.AsString();
                hddGL_ADJ_FV_BS_ID.Value = list[0].GL_ADJ_FV_BS_ID.AsString();
                hddGL_ADJ_INT_INC_ELCLS_PL_ID.Value = list[0].GL_ADJ_INT_INC_ELCLS_PL_ID.AsString();
                hddGL_ADJ_CST_BS_ID.Value = list[0].GL_ADJ_CST_BS_ID.AsString();
                hddGL_REV_CST_PL_ID.Value = list[0].GL_REV_CST_PL_ID.AsString();
                hddGL_ADJ_FEE_BS_ID.Value = list[0].GL_ADJ_FEE_BS_ID.AsString();
                hddGL_REV_FEE_PL_ID.Value = list[0].GL_REV_FEE_PL_ID.AsString();
                hddGL_SUBSEQ_ADJ_CST_BS_ID.Value = list[0].GL_SUBSEQ_ADJ_CST_BS_ID.AsString();
                hddGL_SUBSEQ_ADJ_FEE_BS_ID.Value = list[0].GL_SUBSEQ_ADJ_FEE_BS_ID.AsString();
                hddGL_IMP_LOSS_PL_ID.Value = list[0].GL_IMP_LOSS_PL_ID.AsString();
                hddGL_ALLW_BAD_DEBT_PL_ID.Value = list[0].GL_ALLW_BAD_DEBT_PL_ID.AsString();
                hddGL_WOFF_ADJ_FV_BS_ID.Value = list[0].GL_WOFF_ADJ_FV_BS_ID.AsString();
                hddGL_WOFF_ADJ_FEE_BS_ID.Value = list[0].GL_WOFF_ADJ_FEE_BS_ID.AsString();
                hddGL_WOFF_ADJ_CST_BS_ID.Value = list[0].GL_WOFF_ADJ_CST_BS_ID.AsString();
                hddGL_DAY1_FV_LOSS_PL_ID.Value = list[0].GL_DAY1_FV_LOSS_PL_ID.AsString();
                hddGL_DAY1_ADJ_FV_BS_ID.Value = list[0].GL_DAY1_ADJ_FV_BS_ID.AsString();
                hddGL_WOFF_INT_DISC_LN_ID.Value = list[0].GL_WOFF_INT_DISC_LN_ID.AsString();
                hddGL_DAY1_DEF_EXP_STAFF_BS_ID.Value = list[0].GL_DAY1_DEF_EXP_STAFF_BS_ID.AsString();
                hddGL_AMC_EMP_CST_PL_ID.Value = list[0].GL_AMC_EMP_CST_PL_ID.AsString();
                hddGL_AMC_DEF_EXP_STAFF_BS_ID.Value = list[0].GL_AMC_DEF_EXP_STAFF_BS_ID.AsString();
                hddGL_SUBSIDY_INT_REC_BS_ID.Value = list[0].GL_SUBSIDY_INT_REC_BS_ID.AsString();
                hddGL_SUBSIDY_INT_INC_PL_ID.Value = list[0].GL_SUBSIDY_INT_INC_PL_ID.AsString();

                txtGLAccount.Text = list[0].GLAccount_CODE;
                txtGL_ADJ_INT_INC_PL.Text = list[0].GL_ADJ_INT_INC_PL_CODE;
                txtGL_ADJ_FV_BS.Text = list[0].GL_ADJ_FV_BS_CODE;
                txtGL_ADJ_INT_INC_ELCLS_PL.Text = list[0].GL_ADJ_INT_INC_ELCLS_PL_CODE;
                txtGL_ADJ_CST_BS.Text = list[0].GL_ADJ_CST_BS_CODE;
                txtGL_REV_CST_PL.Text = list[0].GL_REV_CST_PL_CODE;
                txtGL_ADJ_FEE_BS.Text = list[0].GL_ADJ_FEE_BS_CODE;
                txtGL_REV_FEE_PL.Text = list[0].GL_REV_FEE_PL_CODE;
                txtGL_SUBSEQ_ADJ_CST_BS.Text = list[0].GL_SUBSEQ_ADJ_CST_BS_CODE;
                txtGL_SUBSEQ_ADJ_FEE_BS.Text = list[0].GL_SUBSEQ_ADJ_FEE_BS_CODE;
                txtGL_IMP_LOSS_PL.Text = list[0].GL_IMP_LOSS_PL_CODE;
                txtGL_ALLW_BAD_DEBT_PL.Text = list[0].GL_ALLW_BAD_DEBT_PL_CODE;
                txtGL_WOFF_ADJ_FV_BS.Text = list[0].GL_WOFF_ADJ_FV_BS_CODE;
                txtGL_WOFF_ADJ_FEE_BS.Text = list[0].GL_WOFF_ADJ_FEE_BS_CODE;
                txtGL_WOFF_ADJ_CST_BS.Text = list[0].GL_WOFF_ADJ_CST_BS_CODE;
                txtGL_DAY1_FV_LOSS_PL.Text = list[0].GL_DAY1_FV_LOSS_PL_CODE;
                txtGL_DAY1_ADJ_FV_BS.Text = list[0].GL_DAY1_ADJ_FV_BS_CODE;
                txtGL_WOFF_INT_DISC_LN.Text = list[0].GL_WOFF_INT_DISC_LN_CODE;
                txtGL_DAY1_DEF_EXP_STAFF_BS.Text = list[0].GL_DAY1_DEF_EXP_STAFF_BS_CODE;
                txtGL_AMC_EMP_CST_PL.Text = list[0].GL_AMC_EMP_CST_PL_CODE;
                txtGL_AMC_DEF_EXP_STAFF_BS.Text = list[0].GL_AMC_DEF_EXP_STAFF_BS_CODE;
                txtGL_SUBSIDY_INT_REC_BS.Text = list[0].GL_SUBSIDY_INT_REC_BS_CODE;
                txtGL_SUBSIDY_INT_INC_PL.Text = list[0].GL_SUBSIDY_INT_INC_PL_CODE;

                txtGLAccountName.Text = list[0].GLAccount_NAME;
                txtGL_ADJ_INT_INC_PL_NAME.Text = list[0].GL_ADJ_INT_INC_PL_NAME;
                txtGL_ADJ_FV_BS_NAME.Text = list[0].GL_ADJ_FV_BS_NAME;
                txtGL_ADJ_INT_INC_ELCLS_PL_NAME.Text = list[0].GL_ADJ_INT_INC_ELCLS_PL_NAME;
                txtGL_ADJ_CST_BS_NAME.Text = list[0].GL_ADJ_CST_BS_NAME;
                txtGL_REV_CST_PL_NAME.Text = list[0].GL_REV_CST_PL_NAME;
                txtGL_ADJ_FEE_BS_NAME.Text = list[0].GL_ADJ_FEE_BS_NAME;
                txtGL_REV_FEE_PL_NAME.Text = list[0].GL_REV_FEE_PL_NAME;
                txtGL_SUBSEQ_ADJ_CST_BS_NAME.Text = list[0].GL_SUBSEQ_ADJ_CST_BS_NAME;
                txtGL_SUBSEQ_ADJ_FEE_BS_NAME.Text = list[0].GL_SUBSEQ_ADJ_FEE_BS_NAME;
                txtGL_IMP_LOSS_PL_NAME.Text = list[0].GL_IMP_LOSS_PL_NAME;
                txtGL_ALLW_BAD_DEBT_PL_NAME.Text = list[0].GL_ALLW_BAD_DEBT_PL_NAME;
                txtGL_WOFF_ADJ_FV_BS_NAME.Text = list[0].GL_WOFF_ADJ_FV_BS_NAME;
                txtGL_WOFF_ADJ_FEE_BS_NAME.Text = list[0].GL_WOFF_ADJ_FEE_BS_NAME;
                txtGL_WOFF_ADJ_CST_BS_NAME.Text = list[0].GL_WOFF_ADJ_CST_BS_NAME;
                txtGL_DAY1_FV_LOSS_PL_NAME.Text = list[0].GL_DAY1_FV_LOSS_PL_NAME;
                txtGL_DAY1_ADJ_FV_BS_NAME.Text = list[0].GL_DAY1_ADJ_FV_BS_NAME;
                txtGL_WOFF_INT_DISC_LN_NAME.Text = list[0].GL_WOFF_INT_DISC_LN_NAME;
                txtGL_DAY1_DEF_EXP_STAFF_BS_NAME.Text = list[0].GL_DAY1_DEF_EXP_STAFF_BS_NAME;
                txtGL_AMC_EMP_CST_PL_NAME.Text = list[0].GL_AMC_EMP_CST_PL_NAME;
                txtGL_AMC_DEF_EXP_STAFF_BS_NAME.Text = list[0].GL_AMC_DEF_EXP_STAFF_BS_NAME;
                txtGL_SUBSIDY_INT_REC_BS_NAME.Text = list[0].GL_SUBSIDY_INT_REC_BS_NAME;
                txtGL_SUBSIDY_INT_INC_PL_NAME.Text = list[0].GL_SUBSIDY_INT_INC_PL_NAME;
            }
        }
    }

    #endregion
}